home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / Project Stationery Support / <replace me PowerPlant>.cp < prev    next >
Encoding:
Text File  |  1995-04-20  |  3.8 KB  |  158 lines  |  [TEXT/MPCC]

  1. // ===========================================================================
  2. //    <replace me PowerPlant>.cp            ©1994, 1995 Metrowerks Inc. All rights reserved.
  3. // ===========================================================================
  4. //    <replace me PowerPlant>.h            (press Command-Tab to open the associated header)
  5. //
  6. //    This file contains the starter code for a PowerPlant applicationd
  7.  
  8.  
  9.  
  10. #include "<replace me PowerPlant>.h"
  11.  
  12. #include <LWindow.h>
  13. #include <PP_Messages.h>
  14. #include <PP_Resources.h>
  15. #include <URegistrar.h>
  16. #include <PPobClasses.h>
  17. #include <LGrowZone.h>
  18. #include <UMemoryMgr.h>
  19. #include <UPowerTools.h>
  20. #include <LEditField.h>
  21.  
  22. // put declarations for resource ids (ResIDTs) here
  23.  
  24.  
  25.  
  26. // ===========================================================================
  27. //        • Main Program
  28. // ===========================================================================
  29.  
  30. void main(void)
  31. {
  32.                                     // Set Debugging options
  33. #ifdef Debug_Throw
  34.     gDebugThrow = debugAction_Alert;
  35. #endif
  36.  
  37. #ifdef Debug_Signal
  38.     gDebugSignal = debugAction_Alert;
  39. #endif
  40.  
  41.     InitializeHeap(4);
  42.     InitializeToolbox();
  43.     new LGrowZone(20000);
  44.  
  45.     CPPStarterApp    theApp;            // replace this with your App type
  46.     theApp.Run();
  47. }
  48.  
  49.  
  50. // ---------------------------------------------------------------------------
  51. //        • CPPStarterApp             // replace this with your App type
  52. // ---------------------------------------------------------------------------
  53. //    Constructor
  54.  
  55. CPPStarterApp::CPPStarterApp()
  56. {
  57.     // Register functions to create core PowerPlant classes
  58.     
  59.     RegisterAllPPClasses();
  60. }
  61.  
  62.  
  63. // ---------------------------------------------------------------------------
  64. //        • ~CPPStarterApp            // replace this with your App type
  65. // ---------------------------------------------------------------------------
  66. //    Destructor
  67. //
  68.  
  69. CPPStarterApp::~CPPStarterApp()
  70. {
  71. }
  72.  
  73. // ---------------------------------------------------------------------------
  74. //        • StartUp
  75. // ---------------------------------------------------------------------------
  76. //    This function lets you do something when the application starts up. 
  77. //    For example, you could issue your own new command, or respond to a system
  78. //  oDoc (open document) event.
  79.  
  80. void
  81. CPPStarterApp::StartUp()
  82. {
  83. //    ObeyCommand(cmd_New, nil);        // example startup action
  84.  
  85. }
  86.  
  87. // ---------------------------------------------------------------------------
  88. //        • ObeyCommand
  89. // ---------------------------------------------------------------------------
  90. //    Respond to commands
  91.  
  92. Boolean
  93. CPPStarterApp::ObeyCommand(
  94.     CommandT    inCommand,
  95.     void        *ioParam)
  96. {
  97.     Boolean        cmdHandled = true;
  98.  
  99.     switch (inCommand) {
  100.     
  101. //                Deal with command messages (defined in PP_Messages.h).
  102. //                Any that you don't handle will be passed to the commander, LApplication
  103.  
  104. /*             //     EXAMPLE:
  105.  
  106.         case cmd_New:
  107.             LWindow            *theWindow;
  108.     
  109.                                         // Edit_Window is a PPob, ResIDT defined above
  110.             theWindow = LWindow::CreateWindow(Edit_Window, this);    
  111.             theWindow->Show();
  112.             break;
  113.  
  114. */
  115.  
  116.         default:
  117.             cmdHandled = LApplication::ObeyCommand(inCommand, ioParam);
  118.             break;
  119.     }
  120.     
  121.     return cmdHandled;
  122. }
  123.  
  124. // ---------------------------------------------------------------------------
  125. //        • FindCommandStatus
  126. // ---------------------------------------------------------------------------
  127. //    This function enables menu commands.
  128. //
  129.  
  130. void
  131. CPPStarterApp::FindCommandStatus(
  132.     CommandT    inCommand,
  133.     Boolean        &outEnabled,
  134.     Boolean        &outUsesMark,
  135.     Char16        &outMark,
  136.     Str255        outName)
  137. {
  138.  
  139.     switch (inCommand) {
  140. //                Return menu item status according to command messages.
  141. //                Any that you don't handle will be passed to the commander, LApplication
  142.  
  143. /*         //     EXAMPLE:
  144.  
  145.         case cmd_New:
  146.             outEnabled = true;            // enable the New command
  147.             outUsesMark = false;        // but it doesn't have a checkmark etc.
  148.             break;
  149.  
  150. */
  151.  
  152.         default:
  153.             LApplication::FindCommandStatus(inCommand, outEnabled,
  154.                                                 outUsesMark, outMark, outName);
  155.             break;
  156.     }
  157. }
  158.